package de.chronicals.UnlimitedSlots;



import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;


public class UnlimitedSlotsCommands implements Listener{
	public UnlimitedSlotsCommands(UnlimitedSlots plugin){
		plugin.getServer().getPluginManager().registerEvents(this, plugin);
	}
	
	//Event /us
	
	@EventHandler
	(priority = EventPriority.HIGHEST)
	public void onPlayerCommandPreprocessEvent(PlayerCommandPreprocessEvent event) {
		
		Player p = event.getPlayer();
		
		if((event.getMessage().toLowerCase().startsWith("/ulreload")) ||
			(event.getMessage().toLowerCase().startsWith("/ul "))  ||
			(event.getMessage().toLowerCase().equals("/ul")))
		{
			if(!event.getPlayer().isOp()) {
				event.setCancelled(false);
				
				p.sendMessage(ChatColor.GRAY + "[UnlimitedSlots] " + ChatColor.GREEN + "Commands in work...");				
				p.sendMessage(ChatColor.GRAY + "[UnlimitedSlots] " + ChatColor.GOLD + "DEV 1.1 R.1");				

			}
		}
			
			
			
		
		}
		//Event /unlimitedslots
		
		@EventHandler
		(priority = EventPriority.HIGHEST)
		public void onPlayerCommandPreprocessEventVersion(PlayerCommandPreprocessEvent event) {
			
			Player p = event.getPlayer();
			
			if((event.getMessage().toLowerCase().startsWith("/unlimited")) ||
				(event.getMessage().toLowerCase().startsWith("/unlimitedslots ")))
			{
				if(!event.getPlayer().isOp()) {
					event.setCancelled(false);
					
					p.sendMessage(ChatColor.GRAY + "[UnlimitedSlots] " + ChatColor.GREEN + "Sorry Commands in work...");				
					p.sendMessage(ChatColor.GRAY + "[UnlimitedSlots] " + ChatColor.GOLD + "DEV 1.1 R.1");				

				}
				
				
				
			
			}
	}
	
	
	    
	}
	



